package top.laoshuzi.designpatterns.base.behavior.interpreter;

/**
 * 变量表达式
 */
public class Variable extends Expression {

    private String name;

    public Variable(String name) {
        this.name = name;
    }

    @Override
    public boolean interpret(Context context) {
        return context.lookup(this);
    }

    @Override
    public String toString() {
        return name;
    }
}
